<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>OPENUTIL | OPENUTIL</title>
    <meta name="description" content="A VitePress site">
    <link rel="preload stylesheet" href="/assets/style.77c6a815.css" as="style">
    
    <script type="module" src="/assets/app.acf3e1cf.js"></script>
    <link rel="preload" href="/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/assets/chunks/framework.419948d5.js">
    <link rel="modulepreload" href="/assets/chunks/theme.00fffdec.js">
    <link rel="modulepreload" href="/assets/guide_index.md.70120f7b.lean.js">
    <link rel="icon" href="/logo.gif">
    <script id="check-dark-light">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-1919c326><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-1919c326 data-v-7e5bc4a5><div class="VPNavBar has-sidebar" data-v-7e5bc4a5 data-v-a0fd61f4><div class="container" data-v-a0fd61f4><div class="title" data-v-a0fd61f4><div class="VPNavBarTitle has-sidebar" data-v-a0fd61f4 data-v-86d1bed8><a class="title" href="/" data-v-86d1bed8><!--[--><!--]--><!----><!--[-->OPENUTIL<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-a0fd61f4><div class="curtain" data-v-a0fd61f4></div><div class="content-body" data-v-a0fd61f4><!--[--><!--]--><div class="VPNavBarSearch search" style="--vp-meta-key:&#39;Meta&#39;;" data-v-a0fd61f4><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-a0fd61f4 data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>首页</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink active" href="/guide/" tabindex="0" data-v-7f418b0f data-v-42ef59de><!--[--><span data-v-42ef59de>文档</span><!--]--></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-9c007e85><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-9c007e85><span class="text" data-v-9c007e85><!----><span data-v-9c007e85>指南</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-9c007e85><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-9c007e85><div class="VPMenu" data-v-9c007e85 data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><p class="title" data-v-69e747b5>文档</p><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link active" href="/guide/" data-v-43f1e123><!--[-->官方文档<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://gitee.com/oauth/authorize?client_id=351c87a68e1b8d3467d2a5a7dfdf5e29d21734fc3e1dd3d2aad67c8dae1ae6c1&amp;redirect_uri=https%3A%2F%2Fwww.yuque.com%2F4n%2Fsdk%2Fhk9whes0qmtkeg3g&amp;response_type=code" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->语雀文档<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://apidoc.gitee.com/FnTop/openutil" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->Api文档<!--]--></a></div><!--]--><!--]--></div><!--]--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><p class="title" data-v-69e747b5>案例</p><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://gitee.com/FnTop/fn-sms" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->SMS短信对接<!--]--></a></div><!--]--><!--]--></div><!--]--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><p class="title" data-v-69e747b5>源码推荐</p><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://gitee.com/FnTop/fn-weixin" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->微信公众号Api组件<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="https://gitee.com/FnTop/fn-weixin-demo" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->微信公众号Api组件Demo<!--]--></a></div><!--]--><!--]--></div><!--]--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><p class="title" data-v-69e747b5>小工具推荐</p><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-43f1e123><a class="VPLink link vp-external-link-icon" href="http://fntop.gitee.io/j4n-file-trans-home/" target="_blank" rel="noreferrer" data-v-43f1e123><!--[-->文件转化助手(离线版)<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-a0fd61f4 data-v-f6a63727><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-f6a63727 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-a0fd61f4 data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-a0fd61f4 data-v-40855f84 data-v-9c007e85><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-9c007e85><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-9c007e85><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-9c007e85><div class="VPMenu" data-v-9c007e85 data-v-e7ea1737><!----><!--[--><!--[--><!----><div class="group" data-v-40855f84><div class="item appearance" data-v-40855f84><p class="label" data-v-40855f84>Appearance</p><div class="appearance-action" data-v-40855f84><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-40855f84 data-v-ce54a7d1 data-v-b1685198><span class="check" data-v-b1685198><span class="icon" data-v-b1685198><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-ce54a7d1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-ce54a7d1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-40855f84><div class="item social-links" data-v-40855f84><div class="VPSocialLinks social-links-list" data-v-40855f84 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-a0fd61f4 data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-1919c326 data-v-79c8c1df><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-79c8c1df><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-79c8c1df><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-79c8c1df>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-79c8c1df data-v-1c15a60a><button data-v-1c15a60a>返回顶部</button><!----></div></div><aside class="VPSidebar" data-v-1919c326 data-v-b00e2fdd><div class="curtain" data-v-b00e2fdd></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-b00e2fdd><span class="visually-hidden" id="sidebar-aria-label" data-v-b00e2fdd> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-b00e2fdd><section class="VPSidebarItem level-0" data-v-b00e2fdd data-v-e31bd47b><!----><div class="items" data-v-e31bd47b><!--[--><div class="VPSidebarItem level-1" data-v-e31bd47b data-v-e31bd47b><div class="item" role="button" data-v-e31bd47b><div class="indicator" data-v-e31bd47b></div><p class="text" data-v-e31bd47b>文档</p><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-1919c326 data-v-669faec9><div class="VPDoc has-sidebar has-aside" data-v-669faec9 data-v-6b87e69f><!--[--><!--]--><div class="container" data-v-6b87e69f><div class="aside" data-v-6b87e69f><div class="aside-curtain" data-v-6b87e69f></div><div class="aside-container" data-v-6b87e69f><div class="aside-content" data-v-6b87e69f><div class="VPDocAside" data-v-6b87e69f data-v-3f215769><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" role="navigation" data-v-3f215769 data-v-6ae8e080><div class="content" data-v-6ae8e080><div class="outline-marker" data-v-6ae8e080></div><div class="outline-title" role="heading" data-v-6ae8e080>目录</div><nav aria-labelledby="doc-outline-aria-label" data-v-6ae8e080><span class="visually-hidden" id="doc-outline-aria-label" data-v-6ae8e080> Table of Contents for current page </span><ul class="root" data-v-6ae8e080 data-v-d0ee3533><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-6b87e69f><div class="content-container" data-v-6b87e69f><!--[--><!--]--><!----><main class="main" data-v-6b87e69f><div style="position:relative;" class="vp-doc _guide_index" data-v-6b87e69f><div><div align="center"><img align="center" src="/logo.webp" style="width:236px;height:218px;" alt="Fn"></div><div style="display:flex;justify-content:center;"><img style="margin:5px 3px;" src="https://gitee.com/FnTop/openutil/badge/star.svg?theme=light" alt="Fn"><img style="margin:5px 3px;" src="https://gitee.com/FnTop/openutil/badge/fork.svg?theme=dark" alt="Fn"><img style="margin:5px 3px;" src="https://img.shields.io/badge/Version-2.0.2-green" alt="Fn"><img style="margin:5px 3px;" src="https://img.shields.io/badge/Apache-License2.0-green" alt="Apache2.0"></div><div style="display:flex;justify-content:center;"><img style="margin:5px 3px;" src="https://img.shields.io/badge/Maven-3.5.2-blue" alt="Maven"><img style="margin:5px 3px;" src="https://img.shields.io/badge/Java-1.8-blue"><img style="margin:5px 3px;" src="https://img.shields.io/badge/SpringBoot-2.6.2-blue"><img style="margin:5px 3px;" src="https://img.shields.io/badge/Author-4n-blue.svg" alt="Fn"></div><h4 id="介绍" tabindex="-1">介绍 <a class="header-anchor" href="#介绍" aria-label="Permalink to &quot;介绍&quot;">​</a></h4><p>开放接口封装 的 <code>spring boot starter</code>，这个<code>starter</code>是为了方便将开放接口进行封装并提供给外部调用。 以注解方式进行快速封装，并且支持丰富的自定义扩展。 点击查看<a href="https://gitee.com/FnTop/fn-sms" target="_blank" rel="noreferrer">使用案例</a></p><h5 id="兼容性" tabindex="-1">兼容性 <a class="header-anchor" href="#兼容性" aria-label="Permalink to &quot;兼容性&quot;">​</a></h5><table><thead><tr><th style="text-align:center;">version</th><th style="text-align:center;">spring boot version</th><th style="text-align:center;">java version</th></tr></thead><tbody><tr><td style="text-align:center;">2.0.2</td><td style="text-align:center;">2.6.2</td><td style="text-align:center;">1.8</td></tr></tbody></table><h5 id="maven" tabindex="-1">maven <a class="header-anchor" href="#maven" aria-label="Permalink to &quot;maven&quot;">​</a></h5><div class="language-xml vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">&lt;</span><span style="color:#85E89D;">dependency</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">    &lt;</span><span style="color:#85E89D;">groupId</span><span style="color:#E1E4E8;">&gt;cn.fntop&lt;/</span><span style="color:#85E89D;">groupId</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">    &lt;</span><span style="color:#85E89D;">artifactId</span><span style="color:#E1E4E8;">&gt;open-api-spring-boot-starter&lt;/</span><span style="color:#85E89D;">artifactId</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">    &lt;</span><span style="color:#85E89D;">version</span><span style="color:#E1E4E8;">&gt;2.0.2&lt;/</span><span style="color:#85E89D;">version</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">&lt;/</span><span style="color:#85E89D;">dependency</span><span style="color:#E1E4E8;">&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">&lt;</span><span style="color:#22863A;">dependency</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">    &lt;</span><span style="color:#22863A;">groupId</span><span style="color:#24292E;">&gt;cn.fntop&lt;/</span><span style="color:#22863A;">groupId</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">    &lt;</span><span style="color:#22863A;">artifactId</span><span style="color:#24292E;">&gt;open-api-spring-boot-starter&lt;/</span><span style="color:#22863A;">artifactId</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">    &lt;</span><span style="color:#22863A;">version</span><span style="color:#24292E;">&gt;2.0.2&lt;/</span><span style="color:#22863A;">version</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">&lt;/</span><span style="color:#22863A;">dependency</span><span style="color:#24292E;">&gt;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h5 id="gradle" tabindex="-1">gradle <a class="header-anchor" href="#gradle" aria-label="Permalink to &quot;gradle&quot;">​</a></h5><div class="language- vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#e1e4e8;">//方式1</span></span>
<span class="line"><span style="color:#e1e4e8;">implementation &#39;cn.fntop:open-api-spring-boot-starter:2.0.2&#39;</span></span>
<span class="line"><span style="color:#e1e4e8;">//方式2</span></span>
<span class="line"><span style="color:#e1e4e8;">implementation group: &#39;cn.fntop&#39;, name: &#39;open-api-spring-boot-starter&#39;, version: &#39;2.0.2&#39;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292e;">//方式1</span></span>
<span class="line"><span style="color:#24292e;">implementation &#39;cn.fntop:open-api-spring-boot-starter:2.0.2&#39;</span></span>
<span class="line"><span style="color:#24292e;">//方式2</span></span>
<span class="line"><span style="color:#24292e;">implementation group: &#39;cn.fntop&#39;, name: &#39;open-api-spring-boot-starter&#39;, version: &#39;2.0.2&#39;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><h4 id="友善提示" tabindex="-1">友善提示 <a class="header-anchor" href="#友善提示" aria-label="Permalink to &quot;友善提示&quot;">​</a></h4><p><img src="/img.png" alt="An image"></p><h3 id="配置" tabindex="-1">配置 <a class="header-anchor" href="#配置" aria-label="Permalink to &quot;配置&quot;">​</a></h3><div class="language-yaml vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#85E89D;">fn</span><span style="color:#E1E4E8;">:</span></span>
<span class="line"><span style="color:#6A737D;">#接口网关，域名+your-context，如果没有context就不用加context，尾部一定要加上`/`</span></span>
<span class="line"><span style="color:#E1E4E8;">  </span><span style="color:#85E89D;">open-gateway</span><span style="color:#E1E4E8;">: </span><span style="color:#9ECBFF;">http://xxx.com/your-context/</span><span style="color:#E1E4E8;"> </span></span>
<span class="line"><span style="color:#E1E4E8;">  </span><span style="color:#6A737D;">#代理</span></span>
<span class="line"><span style="color:#E1E4E8;">  </span><span style="color:#85E89D;">proxy-domain</span><span style="color:#E1E4E8;">: </span><span style="color:#9ECBFF;">xxx</span></span>
<span class="line"><span style="color:#E1E4E8;">  </span><span style="color:#85E89D;">proxy-port</span><span style="color:#E1E4E8;">: </span><span style="color:#9ECBFF;">xxx</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#22863A;">fn</span><span style="color:#24292E;">:</span></span>
<span class="line"><span style="color:#6A737D;">#接口网关，域名+your-context，如果没有context就不用加context，尾部一定要加上`/`</span></span>
<span class="line"><span style="color:#24292E;">  </span><span style="color:#22863A;">open-gateway</span><span style="color:#24292E;">: </span><span style="color:#032F62;">http://xxx.com/your-context/</span><span style="color:#24292E;"> </span></span>
<span class="line"><span style="color:#24292E;">  </span><span style="color:#6A737D;">#代理</span></span>
<span class="line"><span style="color:#24292E;">  </span><span style="color:#22863A;">proxy-domain</span><span style="color:#24292E;">: </span><span style="color:#032F62;">xxx</span></span>
<span class="line"><span style="color:#24292E;">  </span><span style="color:#22863A;">proxy-port</span><span style="color:#24292E;">: </span><span style="color:#032F62;">xxx</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h4 id="配置说明" tabindex="-1">配置说明 <a class="header-anchor" href="#配置说明" aria-label="Permalink to &quot;配置说明&quot;">​</a></h4><table><thead><tr><th style="text-align:left;">配置项</th><th style="text-align:left;">默认值</th><th style="text-align:left;">说明</th></tr></thead><tbody><tr><td style="text-align:left;">fn.open-gateway</td><td style="text-align:left;"><a href="http://xxx.com/your-context/" target="_blank" rel="noreferrer">http://xxx.com/your-context/</a></td><td style="text-align:left;">接口调用网关，默认<a href="http://127.0.0.1:8080/%E3%80%82%E6%9C%AB%E5%B0%BE%E4%B8%80%E5%AE%9A%E8%A6%81%E5%8A%A0%22/%22" target="_blank" rel="noreferrer">http://127.0.0.1:8080/。末尾一定要加&quot;/&quot;</a></td></tr><tr><td style="text-align:left;">fn.proxy-domain</td><td style="text-align:left;">127.0.0.1</td><td style="text-align:left;">代理主机</td></tr><tr><td style="text-align:left;">fn.proxy-port</td><td style="text-align:left;">38672</td><td style="text-align:left;">代理端口</td></tr></tbody></table><h3 id="默认调用" tabindex="-1">默认调用 <a class="header-anchor" href="#默认调用" aria-label="Permalink to &quot;默认调用&quot;">​</a></h3><p>添加依赖项后自动注入<code>OpenApiService</code>即可</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">import</span><span style="color:#E1E4E8;"> org.springframework.beans.factory.annotation.Autowired;</span></span>
<span class="line"><span style="color:#F97583;">import</span><span style="color:#E1E4E8;"> org.springframework.stereotype.Service;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Service</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">Demo</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">//或者</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Service</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">Demo</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">Autowired</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> Object </span><span style="color:#B392F0;">method1</span><span style="color:#E1E4E8;">(){</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#6A737D;">//参数为接口地址</span></span>
<span class="line"><span style="color:#E1E4E8;">        openApiService.</span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;hello/custom&quot;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//OpenApiService 默认封装的接口,如需扩展继续往下阅读</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">interface</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OpenApi</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#6A737D;">//更多注解的使用方式请参考注解附录大纲</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">method</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;GET&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;"> String </span><span style="color:#FFAB70;">suffix</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">method</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;GET&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;"> String </span><span style="color:#FFAB70;">suffix</span><span style="color:#E1E4E8;">, @</span><span style="color:#F97583;">Path</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">value</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;name&quot;</span><span style="color:#E1E4E8;">) String </span><span style="color:#FFAB70;">name</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">method</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;GET&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;"> String </span><span style="color:#FFAB70;">suffix</span><span style="color:#E1E4E8;">, @</span><span style="color:#F97583;">Query</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">value</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;query&quot;</span><span style="color:#E1E4E8;">) String </span><span style="color:#FFAB70;">query</span><span style="color:#E1E4E8;">, </span><span style="color:#F97583;">boolean</span><span style="color:#E1E4E8;"> </span><span style="color:#FFAB70;">isQuery</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">method</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;POST&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">hasBody</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">post</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;"> String </span><span style="color:#FFAB70;">suffix</span><span style="color:#E1E4E8;">, @</span><span style="color:#F97583;">Body</span><span style="color:#E1E4E8;"> Object </span><span style="color:#FFAB70;">object</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">Multipart</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">method</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;POST&quot;</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">hasBody</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">true</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">post</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;"> String </span><span style="color:#FFAB70;">suffix</span><span style="color:#E1E4E8;">,  @</span><span style="color:#F97583;">Query</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">value</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">&quot;folder&quot;</span><span style="color:#E1E4E8;">) String </span><span style="color:#FFAB70;">folder</span><span style="color:#E1E4E8;">, @</span><span style="color:#F97583;">Part</span><span style="color:#E1E4E8;"> MultipartBody.Part... </span><span style="color:#FFAB70;">file</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">import</span><span style="color:#24292E;"> org.springframework.beans.factory.annotation.Autowired;</span></span>
<span class="line"><span style="color:#D73A49;">import</span><span style="color:#24292E;"> org.springframework.stereotype.Service;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Service</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">Demo</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"></span>
<span class="line"><span style="color:#6A737D;">//或者</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Service</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">Demo</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">Autowired</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> Object </span><span style="color:#6F42C1;">method1</span><span style="color:#24292E;">(){</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#6A737D;">//参数为接口地址</span></span>
<span class="line"><span style="color:#24292E;">        openApiService.</span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;hello/custom&quot;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//OpenApiService 默认封装的接口,如需扩展继续往下阅读</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">interface</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OpenApi</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#6A737D;">//更多注解的使用方式请参考注解附录大纲</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">method</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;GET&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;"> String </span><span style="color:#E36209;">suffix</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">method</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;GET&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;"> String </span><span style="color:#E36209;">suffix</span><span style="color:#24292E;">, @</span><span style="color:#D73A49;">Path</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">value</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;name&quot;</span><span style="color:#24292E;">) String </span><span style="color:#E36209;">name</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">method</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;GET&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;"> String </span><span style="color:#E36209;">suffix</span><span style="color:#24292E;">, @</span><span style="color:#D73A49;">Query</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">value</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;query&quot;</span><span style="color:#24292E;">) String </span><span style="color:#E36209;">query</span><span style="color:#24292E;">, </span><span style="color:#D73A49;">boolean</span><span style="color:#24292E;"> </span><span style="color:#E36209;">isQuery</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">method</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;POST&quot;</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">hasBody</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">true</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">post</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;"> String </span><span style="color:#E36209;">suffix</span><span style="color:#24292E;">, @</span><span style="color:#D73A49;">Body</span><span style="color:#24292E;"> Object </span><span style="color:#E36209;">object</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">Multipart</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">method</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;POST&quot;</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">hasBody</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">true</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">post</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;"> String </span><span style="color:#E36209;">suffix</span><span style="color:#24292E;">,  @</span><span style="color:#D73A49;">Query</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">value</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&quot;folder&quot;</span><span style="color:#24292E;">) String </span><span style="color:#E36209;">folder</span><span style="color:#24292E;">, @</span><span style="color:#D73A49;">Part</span><span style="color:#24292E;"> MultipartBody.Part... </span><span style="color:#E36209;">file</span><span style="color:#24292E;">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br></div></div><h3 id="自定义扩展" tabindex="-1">自定义扩展 <a class="header-anchor" href="#自定义扩展" aria-label="Permalink to &quot;自定义扩展&quot;">​</a></h3><p>1、自定义配置</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Configuration</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CustomConfig</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> OpenApiProperties properties;</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">Bean</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> CustomOpenApiService </span><span style="color:#B392F0;">customOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#B392F0;">getInstance</span><span style="color:#E1E4E8;">(properties, CustomOpenApi.class, CustomOpenApiService.class);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Configuration</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CustomConfig</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> OpenApiProperties properties;</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">Bean</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> CustomOpenApiService </span><span style="color:#6F42C1;">customOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#6F42C1;">getInstance</span><span style="color:#24292E;">(properties, CustomOpenApi.class, CustomOpenApiService.class);</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><p>2、自定义开放接口 <code>extends OpenApi</code></p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">interface</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CustomOpenApi</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">extends</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OpenApi</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">GET</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;hello/custom&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Single&lt;</span><span style="color:#F97583;">Object</span><span style="color:#E1E4E8;">&gt; </span><span style="color:#B392F0;">callCustom</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">interface</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CustomOpenApi</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">extends</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OpenApi</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">GET</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;hello/custom&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Single&lt;</span><span style="color:#D73A49;">Object</span><span style="color:#24292E;">&gt; </span><span style="color:#6F42C1;">callCustom</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>3、自定义Service <code>extends OpenApiService</code> , 继承后可沿用OpenApiService默认方法</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CustomOpenApiService</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">extends</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OpenApiService</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> CustomOpenApi api;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CustomOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#79B8FF;">this</span><span style="color:#E1E4E8;">.api </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> (CustomOpenApi) OpenApiService.api;</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> Object </span><span style="color:#B392F0;">callCustom</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">execute</span><span style="color:#E1E4E8;">(api.</span><span style="color:#B392F0;">callCustom</span><span style="color:#E1E4E8;">());</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CustomOpenApiService</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">extends</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OpenApiService</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> CustomOpenApi api;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CustomOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#005CC5;">this</span><span style="color:#24292E;">.api </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> (CustomOpenApi) OpenApiService.api;</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> Object </span><span style="color:#6F42C1;">callCustom</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">execute</span><span style="color:#24292E;">(api.</span><span style="color:#6F42C1;">callCustom</span><span style="color:#24292E;">());</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><p>4、写好工具类后发布到私服。第三方调用直接通过依赖你发布到私服的jar包并通过Spring注入你自定义的<code>customOpenApiService</code>即可调用。</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Service</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">Demo</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> CustomOpenApiService customOpenApiService;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Service</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">Demo</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> CustomOpenApiService customOpenApiService;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="多service" tabindex="-1">多Service <a class="header-anchor" href="#多service" aria-label="Permalink to &quot;多Service&quot;">​</a></h3><p>CustomConfig定义多个<code>@Bean</code>，新增<code>OpenApi</code>子类和<code>OpenApiService</code>子类</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Configuration</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CustomConfig</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> OpenApiProperties properties;</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">Bean</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> CustomOpenApiService </span><span style="color:#B392F0;">customOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#B392F0;">getInstance</span><span style="color:#E1E4E8;">(properties, CustomOpenApi.class, CustomOpenApiService.class);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">Bean</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> OtherOpenApiService </span><span style="color:#B392F0;">otherOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> (OtherOpenApiService) OtherOpenApiService.</span><span style="color:#B392F0;">getInstance</span><span style="color:#E1E4E8;">(properties, OtherOpenApi.class, OtherOpenApiService.class);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Configuration</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CustomConfig</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> OpenApiProperties properties;</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">Bean</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> CustomOpenApiService </span><span style="color:#6F42C1;">customOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#6F42C1;">getInstance</span><span style="color:#24292E;">(properties, CustomOpenApi.class, CustomOpenApiService.class);</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">Bean</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> OtherOpenApiService </span><span style="color:#6F42C1;">otherOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> (OtherOpenApiService) OtherOpenApiService.</span><span style="color:#6F42C1;">getInstance</span><span style="color:#24292E;">(properties, OtherOpenApi.class, OtherOpenApiService.class);</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br></div></div><p>支持自动注入和上下文调用</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Component</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">ApiService</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">final</span><span style="color:#E1E4E8;"> CustomOpenApiService customOpenApiService;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> Object </span><span style="color:#B392F0;">callDefault</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> openApiService.</span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;hello/test&quot;</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> Object </span><span style="color:#B392F0;">callCustom</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> customOpenApiService.</span><span style="color:#B392F0;">callCustom</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> Object </span><span style="color:#B392F0;">callOther</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> OpenApiContext.</span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(OtherOpenApiService.class).</span><span style="color:#B392F0;">other</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Component</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">RequiredArgsConstructor</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">ApiService</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> OpenApiService openApiService;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">final</span><span style="color:#24292E;"> CustomOpenApiService customOpenApiService;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> Object </span><span style="color:#6F42C1;">callDefault</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> openApiService.</span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;hello/test&quot;</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> Object </span><span style="color:#6F42C1;">callCustom</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> customOpenApiService.</span><span style="color:#6F42C1;">callCustom</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> Object </span><span style="color:#6F42C1;">callOther</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> OpenApiContext.</span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(OtherOpenApiService.class).</span><span style="color:#6F42C1;">other</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br></div></div><h3 id="自定义实例" tabindex="-1">自定义实例 <a class="header-anchor" href="#自定义实例" aria-label="Permalink to &quot;自定义实例&quot;">​</a></h3><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Bean</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> CustomOpenApiService </span><span style="color:#B392F0;">customOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">    Proxy proxy </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">new</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">Proxy</span><span style="color:#E1E4E8;">(Proxy.Type.HTTP, </span><span style="color:#F97583;">new</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">InetSocketAddress</span><span style="color:#E1E4E8;">(properties.</span><span style="color:#B392F0;">getProxyDomain</span><span style="color:#E1E4E8;">(), properties.</span><span style="color:#B392F0;">getProxyPort</span><span style="color:#E1E4E8;">()));</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#B392F0;">custom</span><span style="color:#E1E4E8;">(properties, CustomOpenApi.class, CustomOpenApiService.class, </span><span style="color:#79B8FF;">null</span><span style="color:#E1E4E8;">, </span><span style="color:#79B8FF;">null</span><span style="color:#E1E4E8;">, proxy, </span><span style="color:#79B8FF;">null</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Bean</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> CustomOpenApiService </span><span style="color:#6F42C1;">customOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">    Proxy proxy </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">new</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">Proxy</span><span style="color:#24292E;">(Proxy.Type.HTTP, </span><span style="color:#D73A49;">new</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">InetSocketAddress</span><span style="color:#24292E;">(properties.</span><span style="color:#6F42C1;">getProxyDomain</span><span style="color:#24292E;">(), properties.</span><span style="color:#6F42C1;">getProxyPort</span><span style="color:#24292E;">()));</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#6F42C1;">custom</span><span style="color:#24292E;">(properties, CustomOpenApi.class, CustomOpenApiService.class, </span><span style="color:#005CC5;">null</span><span style="color:#24292E;">, </span><span style="color:#005CC5;">null</span><span style="color:#24292E;">, proxy, </span><span style="color:#005CC5;">null</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="自定义序列化策略" tabindex="-1">自定义序列化策略 <a class="header-anchor" href="#自定义序列化策略" aria-label="Permalink to &quot;自定义序列化策略&quot;">​</a></h3><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Bean</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> CustomOpenApiService </span><span style="color:#B392F0;">customOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">    ObjectMapper mapper </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">new</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">ObjectMapper</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">    mapper.</span><span style="color:#B392F0;">configure</span><span style="color:#E1E4E8;">(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, </span><span style="color:#79B8FF;">false</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">    mapper.</span><span style="color:#B392F0;">setSerializationInclusion</span><span style="color:#E1E4E8;">(JsonInclude.Include.NON_NULL);</span></span>
<span class="line"><span style="color:#E1E4E8;">    mapper.</span><span style="color:#B392F0;">setPropertyNamingStrategy</span><span style="color:#E1E4E8;">(PropertyNamingStrategy.LOWER_CAMEL_CASE);</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#B392F0;">custom</span><span style="color:#E1E4E8;">(properties, CustomOpenApi.class, CustomOpenApiService.class, mapper);</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Bean</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> CustomOpenApiService </span><span style="color:#6F42C1;">customOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">    ObjectMapper mapper </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">new</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">ObjectMapper</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">    mapper.</span><span style="color:#6F42C1;">configure</span><span style="color:#24292E;">(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, </span><span style="color:#005CC5;">false</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">    mapper.</span><span style="color:#6F42C1;">setSerializationInclusion</span><span style="color:#24292E;">(JsonInclude.Include.NON_NULL);</span></span>
<span class="line"><span style="color:#24292E;">    mapper.</span><span style="color:#6F42C1;">setPropertyNamingStrategy</span><span style="color:#24292E;">(PropertyNamingStrategy.LOWER_CAMEL_CASE);</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> (CustomOpenApiService) CustomOpenApiService.</span><span style="color:#6F42C1;">custom</span><span style="color:#24292E;">(properties, CustomOpenApi.class, CustomOpenApiService.class, mapper);</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="支持多线程" tabindex="-1">支持多线程 <a class="header-anchor" href="#支持多线程" aria-label="Permalink to &quot;支持多线程&quot;">​</a></h3><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">class</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OtherOpenApiService</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">extends</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OpenApiService</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">private</span><span style="color:#E1E4E8;"> OtherOpenApi api;</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">OtherOpenApiService</span><span style="color:#E1E4E8;">() {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#79B8FF;">this</span><span style="color:#E1E4E8;">.api </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> (OtherOpenApi) OpenApiService.api;</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> SmsResponse </span><span style="color:#B392F0;">other</span><span style="color:#E1E4E8;">(SmsRequest </span><span style="color:#FFAB70;">request</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#6A737D;">//使用内部封装的多线程</span></span>
<span class="line"><span style="color:#E1E4E8;">        OtherOpenApiService.</span><span style="color:#B392F0;">setExecutorService</span><span style="color:#E1E4E8;">(Executors.</span><span style="color:#B392F0;">newCachedThreadPool</span><span style="color:#E1E4E8;">());</span></span>
<span class="line"><span style="color:#E1E4E8;">        OtherOpenApiService.</span><span style="color:#B392F0;">setDefaultExecutorTimeout</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">500</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">        OtherOpenApiService.</span><span style="color:#B392F0;">setResponseTimeout</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">30</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">execute</span><span style="color:#E1E4E8;">(api.</span><span style="color:#B392F0;">other</span><span style="color:#E1E4E8;">(request));</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span>
<span class="line"><span style="color:#6A737D;">//也可以自己写个多线程。</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">SneakyThrows</span></span>
<span class="line"><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> SmsResponse </span><span style="color:#B392F0;">other</span><span style="color:#E1E4E8;">(SmsRequest request) {</span></span>
<span class="line"><span style="color:#E1E4E8;">    ExecutorService executor </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> Executors.</span><span style="color:#B392F0;">newCachedThreadPool</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">    SmsResponse response </span><span style="color:#F97583;">=</span><span style="color:#E1E4E8;"> executor.</span><span style="color:#B392F0;">submit</span><span style="color:#E1E4E8;">(() </span><span style="color:#F97583;">-&gt;</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">execute</span><span style="color:#E1E4E8;">(api.</span><span style="color:#B392F0;">other</span><span style="color:#E1E4E8;">(request))).</span><span style="color:#B392F0;">get</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">30</span><span style="color:#E1E4E8;">, TimeUnit.SECONDS);</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">try</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#6A737D;">//先停止接收任务，然后再等待一定的时间让所有的任务都执行完毕，如果超过了给定的时间，则立刻结束任务。</span></span>
<span class="line"><span style="color:#E1E4E8;">        executor.</span><span style="color:#B392F0;">shutdown</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">        </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> (</span><span style="color:#F97583;">!</span><span style="color:#E1E4E8;">executor.</span><span style="color:#B392F0;">awaitTermination</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">800</span><span style="color:#E1E4E8;">, TimeUnit.MILLISECONDS)) {</span></span>
<span class="line"><span style="color:#E1E4E8;">            executor.</span><span style="color:#B392F0;">shutdownNow</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">        }</span></span>
<span class="line"><span style="color:#E1E4E8;">    } </span><span style="color:#F97583;">catch</span><span style="color:#E1E4E8;"> (InterruptedException </span><span style="color:#FFAB70;">e</span><span style="color:#E1E4E8;">) {</span></span>
<span class="line"><span style="color:#E1E4E8;">        executor.</span><span style="color:#B392F0;">shutdownNow</span><span style="color:#E1E4E8;">();</span></span>
<span class="line"><span style="color:#E1E4E8;">    }</span></span>
<span class="line"><span style="color:#E1E4E8;">    </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> response;</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">class</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OtherOpenApiService</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">extends</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OpenApiService</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">private</span><span style="color:#24292E;"> OtherOpenApi api;</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">OtherOpenApiService</span><span style="color:#24292E;">() {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#005CC5;">this</span><span style="color:#24292E;">.api </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> (OtherOpenApi) OpenApiService.api;</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> SmsResponse </span><span style="color:#6F42C1;">other</span><span style="color:#24292E;">(SmsRequest </span><span style="color:#E36209;">request</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#6A737D;">//使用内部封装的多线程</span></span>
<span class="line"><span style="color:#24292E;">        OtherOpenApiService.</span><span style="color:#6F42C1;">setExecutorService</span><span style="color:#24292E;">(Executors.</span><span style="color:#6F42C1;">newCachedThreadPool</span><span style="color:#24292E;">());</span></span>
<span class="line"><span style="color:#24292E;">        OtherOpenApiService.</span><span style="color:#6F42C1;">setDefaultExecutorTimeout</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">500</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">        OtherOpenApiService.</span><span style="color:#6F42C1;">setResponseTimeout</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">30</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">execute</span><span style="color:#24292E;">(api.</span><span style="color:#6F42C1;">other</span><span style="color:#24292E;">(request));</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">}</span></span>
<span class="line"><span style="color:#6A737D;">//也可以自己写个多线程。</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">SneakyThrows</span></span>
<span class="line"><span style="color:#D73A49;">public</span><span style="color:#24292E;"> SmsResponse </span><span style="color:#6F42C1;">other</span><span style="color:#24292E;">(SmsRequest request) {</span></span>
<span class="line"><span style="color:#24292E;">    ExecutorService executor </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> Executors.</span><span style="color:#6F42C1;">newCachedThreadPool</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">    SmsResponse response </span><span style="color:#D73A49;">=</span><span style="color:#24292E;"> executor.</span><span style="color:#6F42C1;">submit</span><span style="color:#24292E;">(() </span><span style="color:#D73A49;">-&gt;</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">execute</span><span style="color:#24292E;">(api.</span><span style="color:#6F42C1;">other</span><span style="color:#24292E;">(request))).</span><span style="color:#6F42C1;">get</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">30</span><span style="color:#24292E;">, TimeUnit.SECONDS);</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">try</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#6A737D;">//先停止接收任务，然后再等待一定的时间让所有的任务都执行完毕，如果超过了给定的时间，则立刻结束任务。</span></span>
<span class="line"><span style="color:#24292E;">        executor.</span><span style="color:#6F42C1;">shutdown</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">        </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> (</span><span style="color:#D73A49;">!</span><span style="color:#24292E;">executor.</span><span style="color:#6F42C1;">awaitTermination</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">800</span><span style="color:#24292E;">, TimeUnit.MILLISECONDS)) {</span></span>
<span class="line"><span style="color:#24292E;">            executor.</span><span style="color:#6F42C1;">shutdownNow</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">        }</span></span>
<span class="line"><span style="color:#24292E;">    } </span><span style="color:#D73A49;">catch</span><span style="color:#24292E;"> (InterruptedException </span><span style="color:#E36209;">e</span><span style="color:#24292E;">) {</span></span>
<span class="line"><span style="color:#24292E;">        executor.</span><span style="color:#6F42C1;">shutdownNow</span><span style="color:#24292E;">();</span></span>
<span class="line"><span style="color:#24292E;">    }</span></span>
<span class="line"><span style="color:#24292E;">    </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> response;</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br></div></div><h3 id="注意事项" tabindex="-1">注意事项 <a class="header-anchor" href="#注意事项" aria-label="Permalink to &quot;注意事项&quot;">​</a></h3><p>1、只需要扩写<code>CustomOpenApi</code>接口和<code>CustomOpenApiService</code>接口即可，如果请求和响应是对象换成自定义的实体类即可</p><p>2、返回的对象基本上是<code>Single&lt;T&gt;</code>或者<code>Call&lt;T&gt;（用于stream）</code> ,具体查看<code>com.theokanning.openai.OpenApiService</code></p><h3 id="注解附录" tabindex="-1">注解附录 <a class="header-anchor" href="#注解附录" aria-label="Permalink to &quot;注解附录&quot;">​</a></h3><table><thead><tr><th style="text-align:left;">配置项</th><th style="text-align:left;">默认值</th><th style="text-align:left;">说明</th></tr></thead><tbody><tr><td style="text-align:left;">fn.open-gateway</td><td style="text-align:left;"><a href="http://xxx.com/your-context/" target="_blank" rel="noreferrer">http://xxx.com/your-context/</a></td><td style="text-align:left;">接口调用网关，默认<a href="http://127.0.0.1:8080/%E3%80%82%E6%9C%AB%E5%B0%BE%E4%B8%80%E5%AE%9A%E8%A6%81%E5%8A%A0%22/%22" target="_blank" rel="noreferrer">http://127.0.0.1:8080/。末尾一定要加&quot;/&quot;</a></td></tr><tr><td style="text-align:left;">fn.proxy-domain</td><td style="text-align:left;">127.0.0.1</td><td style="text-align:left;">代理主机</td></tr><tr><td style="text-align:left;">fn.proxy-port</td><td style="text-align:left;">38672</td><td style="text-align:left;">代理端口</td></tr></tbody></table><p>更多注解说明参考如下</p><div class="language-java vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">Create an implementation of the API endpoints defined by the service interface.</span></span>
<span class="line"><span style="color:#E1E4E8;">The relative path </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> a given method is obtained from an annotation on the method describing the request type. The built</span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">in methods are GET, PUT, POST, PATCH, HEAD, DELETE and OPTIONS. You can use a custom HTTP method with @</span><span style="color:#F97583;">HTTP</span><span style="color:#E1E4E8;">. For a dynamic URL, omit the path on the annotation and annotate the first parameter with @</span><span style="color:#F97583;">Url</span><span style="color:#E1E4E8;">.</span></span>
<span class="line"><span style="color:#E1E4E8;">Method parameters can be used to replace parts of the URL by annotating them with @</span><span style="color:#F97583;">Path</span><span style="color:#E1E4E8;">. Replacement sections are denoted by an identifier surrounded by curly </span><span style="color:#B392F0;">braces</span><span style="color:#E1E4E8;"> (e.g., </span><span style="color:#9ECBFF;">&quot;{foo}&quot;</span><span style="color:#E1E4E8;">). To add items to the query string of a URL use @</span><span style="color:#F97583;">Query</span><span style="color:#E1E4E8;">.</span></span>
<span class="line"><span style="color:#E1E4E8;">The body of a request is denoted by the @</span><span style="color:#F97583;">Body</span><span style="color:#E1E4E8;"> annotation. The object will be converted to request representation by one of the Converter.Factory instances. A RequestBody can also be used </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> a raw representation.</span></span>
<span class="line"><span style="color:#E1E4E8;">Alternative request body formats are supported by method annotations and corresponding parameter annotations</span><span style="color:#F97583;">:</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">FormUrlEncoded</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;"> Form</span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">encoded data with key</span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">value pairs specified by the @</span><span style="color:#F97583;">Field</span><span style="color:#E1E4E8;"> parameter annotation.</span></span>
<span class="line"><span style="color:#E1E4E8;">@</span><span style="color:#F97583;">Multipart</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;"> RFC </span><span style="color:#79B8FF;">2388</span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">compliant multipart data with parts specified by the @</span><span style="color:#F97583;">Part</span><span style="color:#E1E4E8;"> parameter annotation.</span></span>
<span class="line"><span style="color:#E1E4E8;">Additional </span><span style="color:#F97583;">static</span><span style="color:#E1E4E8;"> headers can be added </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> an endpoint using the @</span><span style="color:#F97583;">Headers</span><span style="color:#E1E4E8;"> method annotation. For per</span><span style="color:#F97583;">-</span><span style="color:#E1E4E8;">request control over a header annotate a parameter with @</span><span style="color:#F97583;">Header</span><span style="color:#E1E4E8;">.</span></span>
<span class="line"><span style="color:#E1E4E8;">By </span><span style="color:#F97583;">default</span><span style="color:#E1E4E8;">, methods </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> a Call which represents the HTTP request. The generic parameter of the call is the response body type and will be converted by one of the Converter.Factory instances. ResponseBody can also be used </span><span style="color:#F97583;">for</span><span style="color:#E1E4E8;"> a raw representation. Void can be used </span><span style="color:#F97583;">if</span><span style="color:#E1E4E8;"> you </span><span style="color:#F97583;">do</span><span style="color:#E1E4E8;"> not care about the body contents.</span></span>
<span class="line"><span style="color:#E1E4E8;">For example</span><span style="color:#F97583;">:</span></span>
<span class="line"><span style="color:#E1E4E8;">  </span><span style="color:#F97583;">public</span><span style="color:#E1E4E8;"> </span><span style="color:#F97583;">interface</span><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">CategoryService</span><span style="color:#E1E4E8;"> {</span></span>
<span class="line"><span style="color:#E1E4E8;">    @</span><span style="color:#F97583;">POST</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;category/{cat}/&quot;</span><span style="color:#E1E4E8;">)</span></span>
<span class="line"><span style="color:#E1E4E8;">    Call&lt;List&lt;</span><span style="color:#F97583;">Item</span><span style="color:#E1E4E8;">&gt;&gt; </span><span style="color:#B392F0;">categoryList</span><span style="color:#E1E4E8;">(@</span><span style="color:#F97583;">Path</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;cat&quot;</span><span style="color:#E1E4E8;">) String </span><span style="color:#FFAB70;">a</span><span style="color:#E1E4E8;">, @</span><span style="color:#F97583;">Query</span><span style="color:#E1E4E8;">(</span><span style="color:#9ECBFF;">&quot;page&quot;</span><span style="color:#E1E4E8;">) </span><span style="color:#F97583;">int</span><span style="color:#E1E4E8;"> </span><span style="color:#FFAB70;">b</span><span style="color:#E1E4E8;">);</span></span>
<span class="line"><span style="color:#E1E4E8;">  }</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">Create an implementation of the API endpoints defined by the service interface.</span></span>
<span class="line"><span style="color:#24292E;">The relative path </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> a given method is obtained from an annotation on the method describing the request type. The built</span><span style="color:#D73A49;">-</span><span style="color:#24292E;">in methods are GET, PUT, POST, PATCH, HEAD, DELETE and OPTIONS. You can use a custom HTTP method with @</span><span style="color:#D73A49;">HTTP</span><span style="color:#24292E;">. For a dynamic URL, omit the path on the annotation and annotate the first parameter with @</span><span style="color:#D73A49;">Url</span><span style="color:#24292E;">.</span></span>
<span class="line"><span style="color:#24292E;">Method parameters can be used to replace parts of the URL by annotating them with @</span><span style="color:#D73A49;">Path</span><span style="color:#24292E;">. Replacement sections are denoted by an identifier surrounded by curly </span><span style="color:#6F42C1;">braces</span><span style="color:#24292E;"> (e.g., </span><span style="color:#032F62;">&quot;{foo}&quot;</span><span style="color:#24292E;">). To add items to the query string of a URL use @</span><span style="color:#D73A49;">Query</span><span style="color:#24292E;">.</span></span>
<span class="line"><span style="color:#24292E;">The body of a request is denoted by the @</span><span style="color:#D73A49;">Body</span><span style="color:#24292E;"> annotation. The object will be converted to request representation by one of the Converter.Factory instances. A RequestBody can also be used </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> a raw representation.</span></span>
<span class="line"><span style="color:#24292E;">Alternative request body formats are supported by method annotations and corresponding parameter annotations</span><span style="color:#D73A49;">:</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">FormUrlEncoded</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">-</span><span style="color:#24292E;"> Form</span><span style="color:#D73A49;">-</span><span style="color:#24292E;">encoded data with key</span><span style="color:#D73A49;">-</span><span style="color:#24292E;">value pairs specified by the @</span><span style="color:#D73A49;">Field</span><span style="color:#24292E;"> parameter annotation.</span></span>
<span class="line"><span style="color:#24292E;">@</span><span style="color:#D73A49;">Multipart</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">-</span><span style="color:#24292E;"> RFC </span><span style="color:#005CC5;">2388</span><span style="color:#D73A49;">-</span><span style="color:#24292E;">compliant multipart data with parts specified by the @</span><span style="color:#D73A49;">Part</span><span style="color:#24292E;"> parameter annotation.</span></span>
<span class="line"><span style="color:#24292E;">Additional </span><span style="color:#D73A49;">static</span><span style="color:#24292E;"> headers can be added </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> an endpoint using the @</span><span style="color:#D73A49;">Headers</span><span style="color:#24292E;"> method annotation. For per</span><span style="color:#D73A49;">-</span><span style="color:#24292E;">request control over a header annotate a parameter with @</span><span style="color:#D73A49;">Header</span><span style="color:#24292E;">.</span></span>
<span class="line"><span style="color:#24292E;">By </span><span style="color:#D73A49;">default</span><span style="color:#24292E;">, methods </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> a Call which represents the HTTP request. The generic parameter of the call is the response body type and will be converted by one of the Converter.Factory instances. ResponseBody can also be used </span><span style="color:#D73A49;">for</span><span style="color:#24292E;"> a raw representation. Void can be used </span><span style="color:#D73A49;">if</span><span style="color:#24292E;"> you </span><span style="color:#D73A49;">do</span><span style="color:#24292E;"> not care about the body contents.</span></span>
<span class="line"><span style="color:#24292E;">For example</span><span style="color:#D73A49;">:</span></span>
<span class="line"><span style="color:#24292E;">  </span><span style="color:#D73A49;">public</span><span style="color:#24292E;"> </span><span style="color:#D73A49;">interface</span><span style="color:#24292E;"> </span><span style="color:#6F42C1;">CategoryService</span><span style="color:#24292E;"> {</span></span>
<span class="line"><span style="color:#24292E;">    @</span><span style="color:#D73A49;">POST</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;category/{cat}/&quot;</span><span style="color:#24292E;">)</span></span>
<span class="line"><span style="color:#24292E;">    Call&lt;List&lt;</span><span style="color:#D73A49;">Item</span><span style="color:#24292E;">&gt;&gt; </span><span style="color:#6F42C1;">categoryList</span><span style="color:#24292E;">(@</span><span style="color:#D73A49;">Path</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;cat&quot;</span><span style="color:#24292E;">) String </span><span style="color:#E36209;">a</span><span style="color:#24292E;">, @</span><span style="color:#D73A49;">Query</span><span style="color:#24292E;">(</span><span style="color:#032F62;">&quot;page&quot;</span><span style="color:#24292E;">) </span><span style="color:#D73A49;">int</span><span style="color:#24292E;"> </span><span style="color:#E36209;">b</span><span style="color:#24292E;">);</span></span>
<span class="line"><span style="color:#24292E;">  }</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h3 id="常见问题" tabindex="-1">常见问题 <a class="header-anchor" href="#常见问题" aria-label="Permalink to &quot;常见问题&quot;">​</a></h3><h4 id="使用阿里云镜像无法拉取" tabindex="-1">使用阿里云镜像无法拉取 <a class="header-anchor" href="#使用阿里云镜像无法拉取" aria-label="Permalink to &quot;使用阿里云镜像无法拉取&quot;">​</a></h4><p>尝试如下代码，central没用的话改成<code>*</code>或<code>all</code>试试</p><div class="language-xml vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#E1E4E8;">&lt;</span><span style="color:#85E89D;">mirrors</span><span style="color:#E1E4E8;">&gt;	</span></span>
<span class="line"><span style="color:#E1E4E8;">	    &lt;</span><span style="color:#85E89D;">mirror</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">            &lt;</span><span style="color:#85E89D;">id</span><span style="color:#E1E4E8;">&gt;alimaven&lt;/</span><span style="color:#85E89D;">id</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">            &lt;</span><span style="color:#85E89D;">name</span><span style="color:#E1E4E8;">&gt;aliyun maven&lt;/</span><span style="color:#85E89D;">name</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">            &lt;</span><span style="color:#85E89D;">url</span><span style="color:#E1E4E8;">&gt;http://maven.aliyun.com/nexus/content/groups/public/&lt;/</span><span style="color:#85E89D;">url</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">            &lt;</span><span style="color:#85E89D;">mirrorOf</span><span style="color:#E1E4E8;">&gt;central&lt;/</span><span style="color:#85E89D;">mirrorOf</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">        &lt;/</span><span style="color:#85E89D;">mirror</span><span style="color:#E1E4E8;">&gt;</span></span>
<span class="line"><span style="color:#E1E4E8;">    &lt;/</span><span style="color:#85E89D;">mirrors</span><span style="color:#E1E4E8;">&gt;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#24292E;">&lt;</span><span style="color:#22863A;">mirrors</span><span style="color:#24292E;">&gt;	</span></span>
<span class="line"><span style="color:#24292E;">	    &lt;</span><span style="color:#22863A;">mirror</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">            &lt;</span><span style="color:#22863A;">id</span><span style="color:#24292E;">&gt;alimaven&lt;/</span><span style="color:#22863A;">id</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">            &lt;</span><span style="color:#22863A;">name</span><span style="color:#24292E;">&gt;aliyun maven&lt;/</span><span style="color:#22863A;">name</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">            &lt;</span><span style="color:#22863A;">url</span><span style="color:#24292E;">&gt;http://maven.aliyun.com/nexus/content/groups/public/&lt;/</span><span style="color:#22863A;">url</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">            &lt;</span><span style="color:#22863A;">mirrorOf</span><span style="color:#24292E;">&gt;central&lt;/</span><span style="color:#22863A;">mirrorOf</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">        &lt;/</span><span style="color:#22863A;">mirror</span><span style="color:#24292E;">&gt;</span></span>
<span class="line"><span style="color:#24292E;">    &lt;/</span><span style="color:#22863A;">mirrors</span><span style="color:#24292E;">&gt;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h3 id="更新说明" tabindex="-1">更新说明 <a class="header-anchor" href="#更新说明" aria-label="Permalink to &quot;更新说明&quot;">​</a></h3><h4 id="_2023-08-14" tabindex="-1">2023-08-14 <img src="https://img.shields.io/badge/version-2.0.2-green"> <a class="header-anchor" href="#_2023-08-14" aria-label="Permalink to &quot;2023-08-14 &lt;img src=&quot;https://img.shields.io/badge/version-2.0.2-green&quot;&gt;&quot;">​</a></h4><ul><li>废弃2.0.1版本调用自定义方法实现多线程的逻辑，替换为在Service层进行实现</li><li>删除所有自定义方法custom方法中ExecutorService 参数</li><li>2.0.1的多线程模式是可用的，但不能通过custom方法初始化，必须使用Service进行调用。</li></ul><h4 id="_2023-08-14-1" tabindex="-1">2023-08-14 <img src="https://img.shields.io/badge/version-2.0.1-green"> <a class="header-anchor" href="#_2023-08-14-1" aria-label="Permalink to &quot;2023-08-14 &lt;img src=&quot;https://img.shields.io/badge/version-2.0.1-green&quot;&gt;&quot;">​</a></h4><ul><li>优化封装逻辑</li><li>支持<code>多线程</code></li><li>如果继承<code>OpenApiService</code>,可沿用其方法。如果继承 <code>OpenApiServiceAbstract</code> ，则为独立功能</li></ul><h4 id="_2023-08-10" tabindex="-1">2023-08-10 <img src="https://img.shields.io/badge/version-2.0.0-green"> <a class="header-anchor" href="#_2023-08-10" aria-label="Permalink to &quot;2023-08-10 &lt;img src=&quot;https://img.shields.io/badge/version-2.0.0-green&quot;&gt;&quot;">​</a></h4><ul><li>支持<code>自定义序列化策略</code>（解决1.2.0版本接口调用部分字段无法传递问题，1.2.0版本的字段序列化对象命名规则是app_id,如果命名成appId属性无法传递）</li><li>对象序列化策略-- 2.0.0版本默认策略：PropertyNamingStrategy.LOWER_CAMEL_CASE （小写驼峰 》 appId） || 1.2.0以下版本默认策略：PropertyNamingStrategy.SNAKE_CASE (小写下划线 》 app_id)</li></ul><h4 id="_2023-08-04" tabindex="-1">2023-08-04 <img src="https://img.shields.io/badge/version-1.2.0-green"> <a class="header-anchor" href="#_2023-08-04" aria-label="Permalink to &quot;2023-08-04 &lt;img src=&quot;https://img.shields.io/badge/version-1.2.0-green&quot;&gt;&quot;">​</a></h4><ul><li>支持<code>自定义实例</code></li></ul><h4 id="_2023-08-04-1" tabindex="-1">2023-08-04 <img src="https://img.shields.io/badge/version-1.1.0-green"> <a class="header-anchor" href="#_2023-08-04-1" aria-label="Permalink to &quot;2023-08-04 &lt;img src=&quot;https://img.shields.io/badge/version-1.1.0-green&quot;&gt;&quot;">​</a></h4><ul><li>支持<code>多Service</code>功能（无需添加@Primary）</li></ul><h4 id="_2023-08-03" tabindex="-1">2023-08-03 <img src="https://img.shields.io/badge/version-1.0.0-green"> <a class="header-anchor" href="#_2023-08-03" aria-label="Permalink to &quot;2023-08-03 &lt;img src=&quot;https://img.shields.io/badge/version-1.0.0-green&quot;&gt;&quot;">​</a></h4><ul><li>依赖 java1.8</li><li>依赖 spring-boot2.6.2</li><li>依赖 hutool-all5.8.11</li><li>新增 get,post默认请求方法调用</li><li>支持自定义接口扩展，只支持单Service配置（单个Service配置@Bean，还需要添加@Primary）</li></ul></div></div></main><footer class="VPDocFooter" data-v-6b87e69f data-v-ef5dee53><!--[--><!--]--><div class="edit-info" data-v-ef5dee53><div class="edit-link" data-v-ef5dee53><a class="VPLink link vp-external-link-icon no-icon edit-link-button" href="https://github.com/vuejs/vitepress/edit/main/docs/guide/index.md" target="_blank" rel="noreferrer" data-v-ef5dee53><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="edit-link-icon" aria-label="edit icon" data-v-ef5dee53><path d="M18,23H4c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h7c0.6,0,1,0.4,1,1s-0.4,1-1,1H4C3.4,5,3,5.4,3,6v14c0,0.6,0.4,1,1,1h14c0.6,0,1-0.4,1-1v-7c0-0.6,0.4-1,1-1s1,0.4,1,1v7C21,21.7,19.7,23,18,23z"></path><path d="M8,17c-0.3,0-0.5-0.1-0.7-0.3C7,16.5,6.9,16.1,7,15.8l1-4c0-0.2,0.1-0.3,0.3-0.5l9.5-9.5c1.2-1.2,3.2-1.2,4.4,0c1.2,1.2,1.2,3.2,0,4.4l-9.5,9.5c-0.1,0.1-0.3,0.2-0.5,0.3l-4,1C8.2,17,8.1,17,8,17zM9.9,12.5l-0.5,2.1l2.1-0.5l9.3-9.3c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.2-0.4-1.6,0l0,0L9.9,12.5z M18.5,2.5L18.5,2.5L18.5,2.5z"></path></svg> Edit this page on GitHub<!--]--></a></div><!----></div><!----></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-1919c326 data-v-e03eb2e1><div class="container" data-v-e03eb2e1><p class="message" data-v-e03eb2e1>Released the Apache License on Gitee</p><p class="copyright" data-v-e03eb2e1>Copyright © 2023 cn.fntop</p></div></footer><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"index.md\":\"629f3927\",\"guide_index.md\":\"70120f7b\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"OPENUTIL\",\"description\":\"A VitePress site\",\"base\":\"/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"returnToTopLabel\":\"返回顶部\",\"outline\":{\"level\":\"deep\",\"label\":\"目录\"},\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com\"}],\"editLink\":{\"pattern\":\"https://github.com/vuejs/vitepress/edit/main/docs/:path\",\"text\":\"Edit this page on GitHub\"},\"footer\":{\"message\":\"Released the Apache License on Gitee\",\"copyright\":\"Copyright © 2023 cn.fntop\"},\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"文档\",\"link\":\"/guide/\",\"activeMatch\":\"/guide\"},{\"text\":\"指南\",\"items\":[{\"text\":\"文档\",\"items\":[{\"text\":\"官方文档\",\"link\":\"/guide/\"},{\"text\":\"语雀文档\",\"link\":\"https://gitee.com/oauth/authorize?client_id=351c87a68e1b8d3467d2a5a7dfdf5e29d21734fc3e1dd3d2aad67c8dae1ae6c1&redirect_uri=https%3A%2F%2Fwww.yuque.com%2F4n%2Fsdk%2Fhk9whes0qmtkeg3g&response_type=code\"},{\"text\":\"Api文档\",\"link\":\"https://apidoc.gitee.com/FnTop/openutil\"}]},{\"text\":\"案例\",\"items\":[{\"text\":\"SMS短信对接\",\"link\":\"https://gitee.com/FnTop/fn-sms\"}]},{\"text\":\"源码推荐\",\"items\":[{\"text\":\"微信公众号Api组件\",\"link\":\"https://gitee.com/FnTop/fn-weixin\"},{\"text\":\"微信公众号Api组件Demo\",\"link\":\"https://gitee.com/FnTop/fn-weixin-demo\"}]},{\"text\":\"小工具推荐\",\"items\":[{\"text\":\"文件转化助手(离线版)\",\"link\":\"http://fntop.gitee.io/j4n-file-trans-home/\"}]}]}],\"sidebar\":{\"/guide/\":[{\"text\":\"文档\"}]},\"docFooter\":{\"prev\":\"上一篇\",\"next\":\"下一篇\"}},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":false}");</script>
    
  </body>
</html>